package server.test;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

/**
 * Carica un generico file html ponendo il contenuto in una ArrayList
 * @author cl400782
 *
 */
public class FileLoader {
	

		public  ArrayList<String> loadFile(String filename) {

			ArrayList<String> contenuto = new ArrayList<String>();
			try {
				BufferedReader reader=new BufferedReader(new FileReader(new File("web/"+filename+".html")));
				
				String line=reader.readLine();
				
				while(line!=null){
					
					contenuto.add(line);
					
					line=reader.readLine();
				}
				
				reader.close();
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return contenuto;
		
	}

}
